In Class Exercise 5

A short description of the post.

Kwek Yi Chen https://example.com/kwekyichen
09-13-2021

Installing and Loading the R package

Import the Geospatial data

Importing shapefile using st_read() of sf package. The output object is in tibble sf object class.

Reading layer `MP14_SUBZONE_WEB_PL' from data source 
  `C:\kwekyichen\IS415_blog\_posts\2021-09-13-in-class-exercise-5\data\shapefile' 
  using driver `ESRI Shapefile'
Simple feature collection with 323 features and 15 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
Projected CRS: SVY21

Projection is in svy21.

Importing th Aspatial data from rds folder

read_rds() of readr package is used instead of readRDS() of base R. Ouput of read_rds() is in tibble object.

Note that there are some data issue in childcare data frame because Lat and Lng should be in numeric data type. The coordinate fields seems to be in decimal degree. Hence, wgs referencing system is assumed.

Converting the aspatial data frame into sf object

Note: st_as_sf() accept coordinates in character data type

Plotting to review the chilcare_sf

alpha sets transparency.

Geospatial Data Wrangling

Converting sf to Spatial* data frame

as_Spatial() of sf package

chas: spatialpointsdf chilcare: spatialpointsdf mpsz: spatialpolygondf

Converting Spatial* df into Spaital* objects

as.SpatialPoint() or as.SpatialPolygon() of maptools package

Converting from Spatial* object to ppp object

using as.ppp() of maptools package

Removing duplicate points using jitter

rjitter() of spatstat function

[1] FALSE
[1] FALSE

tmap dont understand ppp…

Extracting Punggol Planning Area

, is necessary to complete syntax

Converting SpatialPolygonDataFrame into SpatialPolygons Object

Converting SpatialPolygons into owin object

owin() of spatstat. need owin to define study area

Extracting spatial points within owin

L-funtion

Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.